<?php
class Level extends Zend_Db_Table_Abstract{
	protected $_name="bk_level";
	function SelectLevelListByTYPE($type){
		global $db;

		$sql = "SELECT * FROM bk_level WHERE TYPE = ? ORDER BY ORDERS";

		return $db->query($sql,$type)->fetchAll();
	}
        
        function SelectLevelListByMultiTYPE($type){
		global $db;

		$sql = "SELECT * FROM bk_level WHERE TYPE IN ('".implode("','", $type)."') ORDER BY ORDERS";
                return $db->query($sql)->fetchAll();
	}
        function SelectLevelByID($id){
		global $db;

		$sql = "SELECT * FROM bk_level WHERE ID_LV=?";

		return $db->query($sql,$id)->fetch();
	}

	function SelectLevelCountByTYPE($type){
		global $db;

		$sql = "SELECT count(*) as CNT FROM bk_level WHERE TYPE = ?";

		$r = $db->query($sql,$type)->fetch();

		return $r["CNT"];
	}

}